#!/bin/sh
if [ ! -f configure.paths ]; then
  echo "No configure.paths found, please run ./configure" >&2
  exit 1
fi

. ./configure.paths

path_bin="$CONFIG_BINPATH"
path_lib="$CONFIG_LIBPATH"
path_include="$CONFIG_INCLUDEPATH"


if [ ! -d "$path_bin" ]; then
  mkdir "$path_bin"
fi

if [ ! -d "$path_lib" ]; then
  mkdir "$path_lib"
fi

if [ ! -d "$path_include" ]; then
  mkdir "$path_include"
fi

if [ ! -d "$path_include/dbfile" ]; then
  mkdir "$path_include/dbfile"
fi

if [ -e /usr/bin/install_name_tool ]; then
  install_name_tool -id $path_lib/libdbfile.dylib ../../lib/libdbfile.dylib
fi
cp ../../lib/libdbfile.* "$path_lib/"
cp ../../include/dbfile/*.h "$path_include/dbfile/"

